package cn.smbms.service.impl;

import cn.smbms.mapper.UserMapper;
import cn.smbms.pojo.User;
import cn.smbms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service("userService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public List<User> getAll() {
        return userMapper.getAll();
    }

    @Override
    public int getCount() {
        return userMapper.getCount();
    }

    @Override
    public List<User> getByUserName(String userName) {
        return userMapper.getByUserName(userName);
    }
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int addUser(User user) {
        return userMapper.add(user);
    }


}
